<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Java源码</title>
    <style type="text/css">
        .keyword{font-weight: bold;color: #0000cc;}
        .comment{color: #0000cc;}
        .var{color: #0000cc;}
    </style>
</head>
<body>
    <pre>
package ch14;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Iterator;
import java.util.TreeSet;

public class ReadWords {
    public static void main(String[] args) throws Exception {
        TreeSet<String> set = new TreeSet<String>();
        FileReader fr_1 = new FileReader(args[0]);
        BufferedReader br_1 = new BufferedReader(fr_1);
        String line_1 = br_1.readLine();
        while (line_1 != null) {
            String[] words = line_1.split("[^a-zA-Z]");
            for (String str : words) {
                if (str.length() != 0)
                    set.add(str);
            }
            line_1 = br_1.readLine();
        }
        br_1.close();
        Iterator iterator = set.iterator();
        while (iterator.hasNext())
            System.out.println(iterator.next());
    }
}
    </pre>
</body>
</html>